<form action="/image/records" method="get" class="filter">
	<label for="label">名称</label>
	<input type="text" class="text" name="label" autocomplete="off"/>

	<input type="hidden" name="category" value="-1"/>
	<span>
		<select name="temp0" class="category">
			<option value="-1">全部</option>
			<?php foreach($categories as $category):?>
				<option value="<?php echo $category->id;?>"><?php echo $category->name;?></option>
			<?php endforeach;?>
		</select>
	</span>

	<input type="submit" class="submit" value="检索"/>
</form>

<ul class="button">
	<li><a href="/image/add" class="add-image">添加图片</a></li>
	<li><a href="/image_category/add" class="add-category">添加分类</a></li>
</ul>

<ul class="records">
	<li data="10">
		<a href="javascript:void(0);">
			<img src="/assets/img/404.jpg" alt="404"/>
		</a>
		<div class="actions">
			<a href="javascript:void(0);" class="edit">	编辑	</a>
			<a href="javascript:void(0);" class="delete">删除</a>
		</div>
	</li>
</ul>

<div class="pagination"></div>

<script type="text/x-jquery-tmpl" id="form-template">
	<form action="/image/${action}" method="post" enctype="multipart/form-data" target="submit-target">
		<input type="hidden" name="id" value="${id}"/>
		<input type="hidden" name="callback" value="${callback}"/>
		<input type="hidden" name="category" value="0"/>
		<div class="form-row">
			<label for="label">名称</label>
			<input type="text" class="text" name="label" value="${label}"/>
		</div>
		<div class="form-row">
			<label for="thumbnail_sizes">缩略图</label>
			<input type="text" class="text" name="thumbnail_sizes" value="${thumbnail_sizes}" style="width:400px;"/>
		</div>
		<div class="form-row">
			<label for="file">图片</label>
			<input type="file" name="file"/>
		</div>
		<div class="form-button">
			<input type="submit" class="submit" value="提交"/>
		</div>
	</form>
	<iframe name="submit-target" style="widht:0;height:0;display:none;"></iframe>
</script>

<script type="text/x-jquery-tmpl" id="list-template">
	{{each categories}}
		<li data="${id}">
			<a href="javascript:void(0);" class="image-container">
				<img src="/assets/upload/img/${$item.thumbnail(name)}" alt="${label}"/>
			</a>
			<div class="label">${category}-${label}</div>
			<div class="created_at">${created_at}</div>
			<div class="actions">
				<a href="/image/edit/${id}" class="edit">
					<img src="/assets/img/edit.png" alt="编辑"/>
				</a>
				<a href="javascript:void(0);" class="delete">
					<img src="/assets/img/delete.png" alt="删除"/>
				</a>
			</div>
		</li>
	{{/each}}
	{{each images}}
	<li data="${id}">
		<a href="javascript:void(0);" class="image-container">
			<img src="/assets/upload/img/${$item.thumbnail(name)}" alt="${label}"/>
		</a>
		<div class="label">${category}-${label}</div>
		<div class="created_at">${created_at}</div>
		<div class="actions">
			<a href="/image/edit/${id}" class="edit">
				<img src="/assets/img/edit.png" alt="编辑"/>
			</a>
			<a href="javascript:void(0);" class="delete">
				<img src="/assets/img/delete.png" alt="删除"/>
			</a>
		</div>
	</li>
	{{/each}}
</script>

<script type="text/x-jquery-tmpl" id="none-template">
	<tr><td colspan="6" style="text-align: center;">没有搜索到结果。</td></tr>
</script>
